﻿-- =============================================
-- Author:		Kevin Orbaker
-- Create date: 10/08/2007
-- Description:	Select alert history counts by application..
-- =============================================
CREATE PROCEDURE [dbo].[usp_select_AlertHistoryReportByService] 
	-- Add the parameters for the stored procedure here
	@ApplicationName varchar(256),
	@BeginDate datetime,
	@EndDate datetime
AS
BEGIN
	DECLARE @DateRange int

	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT ServiceName as [ServiceName], count(*) as [Total]
	FROM AlertHistory
	WHERE [Application] = @ApplicationName
	AND [InsertedDate] between @BeginDate and @EndDate
    group by ServiceName

END
